import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { HomepageComponent } from './homepage/homepage.component';
import { OneComponent } from './one/one.component';
import { TwoComponent } from './two/two.component';
import { ThreeComponent } from './three/three.component';
import { FourComponent } from './four/four.component';
import { FiveComponent } from './five/five.component';

/**
 * 添加一个共享的服务(能处理类似vue中的状态管理的功能)
 */
//import { ValueService } from './value.service';
import { Hero } from './hero';

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    RouterModule.forChild([
       {
          path:'',
          component:HomepageComponent,
          children:[ //配置子路由
             {path:'one',component:OneComponent},
             {path:'two',component:TwoComponent},
             {path:'three',component:ThreeComponent},
             {path:'four',component:FourComponent},
             {path:'five',component:FiveComponent},
             {path:'',redirectTo:'one',pathMatch:'full'},
          ]
        },
    ])
  ],
  declarations: [HomepageComponent, OneComponent, TwoComponent, ThreeComponent, FourComponent, FiveComponent],
  providers:[
   {provide:'TITLE',useValue:'wwwwwwwwwwwwwwwww'},
   {provide:Hero,useValue:new Hero('云傲天',90)}
  ]
})
export class HomeModule { }
